#include <fstream>
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

using namespace std;

// as requested no additional data structure used here
// compare each position with previous, if same, repoint to the next position
int removedup(char *str, int len)
{
  if (len<1)
  {
    cout << "string length is zero\n";
    return 0;
  }
  
  int i=0;
//  for(i=0;i<len;i++)
  while(*(str+i) != 0)
  {
    for(int j=0;j<i;j++)
    {
      if (*(str+j) == *(str+i))
      {
      //  *(str+i) = *(str+i+1);
        for(int m=i;m<=len;m++)
          *(str+m) = *(str+m+1);
        i--;
        break;
      }
    }
    i++;
  }
  return 0;
}

int main(int argc, char *argv[])
{
  if (argc<2)
  {
    cout << "need one input filename\n";
    return 0;
  }

  char *filename = argv[1];
  ifstream infile(filename);
  char *str;
  str = (char *)malloc(128*sizeof(char));
  string in;
  getline(infile, in);
  istringstream ss(in);
  int num;
  ss >> num;
  cout << "test case number is: " << num << endl;
  while(getline(infile, in))
  {
    int len = in.size();
    for (int j=0;j<len;j++)
      *(str+j) = in[j];
    removedup(str, len);
    int i=0;
    while(*(str+i) != 0)
    {
      cout << *(str+i);
      i++;
    }
    cout << "\n-----------------------------------\n";
    memset(str, 0, len);
  }
  free(str);
  return 0;
}
